using IcsSEMCtrl.Util;
namespace Lifter.Global.Device
{
    public class StartupCommunicationState
    {
        public const int _OFFLINE = 0;
        public const int _ONLINE = 1;
        private int _value;
        private static int _size;
        private static StartupCommunicationState[] _array;
        public static string[] displayStrings;
        public static StartupCommunicationState[] displayValues;
        public static StartupCommunicationState OFFLINE;
        public static StartupCommunicationState ONLINE;
        public static StartupCommunicationState IT_ENUM_MAX;
        static StartupCommunicationState()
        {
            StartupCommunicationState._size = 2;
            StartupCommunicationState._array = new StartupCommunicationState[StartupCommunicationState._size];
            StartupCommunicationState.displayStrings = new string[StartupCommunicationState._size];
            StartupCommunicationState.displayValues = new StartupCommunicationState[StartupCommunicationState._size];
            StartupCommunicationState.OFFLINE = new StartupCommunicationState(0);
            StartupCommunicationState.ONLINE = new StartupCommunicationState(1);
            StartupCommunicationState.IT_ENUM_MAX = new StartupCommunicationState(2147483647);
            StartupCommunicationState.displayStrings[0] = "OFFLINE";
            StartupCommunicationState.displayStrings[1] = "ONLINE";
            StartupCommunicationState.displayValues[0] = StartupCommunicationState.OFFLINE;
            StartupCommunicationState.displayValues[1] = StartupCommunicationState.ONLINE;
        }
        public static string ValueToString(StartupCommunicationState val)
        {
            string result;
            switch (val.Value())
            {
                case 0:
                    result = StartupCommunicationState.displayStrings[0];
                    break;
                case 1:
                    result = StartupCommunicationState.displayStrings[1];
                    break;
                default:
                    result = "";
                    break;
            }
            return result;
        }
        public static StartupCommunicationState StringToValue(string val)
        {
            StartupCommunicationState result;
            if (Helper.IsNullOrEmpty(val))
            {
                result = StartupCommunicationState.IT_ENUM_MAX;
            }
            else
            {
                for (int i = 0; i < StartupCommunicationState.displayStrings.Length; i++)
                {
                    if (val.Equals(StartupCommunicationState.displayStrings[i]))
                    {
                        result = StartupCommunicationState.displayValues[i];
                        return result;
                    }
                }
                result = null;
            }
            return result;
        }
        public int Value()
        {
            return this._value;
        }
        public static StartupCommunicationState From_Int(int value)
        {
            StartupCommunicationState result;
            if (value >= 0 && value < StartupCommunicationState._size)
            {
                result = StartupCommunicationState._array[value];
            }
            else
            {
                result = StartupCommunicationState.IT_ENUM_MAX;
            }
            return result;
        }
        protected StartupCommunicationState(int value)
        {
            this._value = value;
            if (value >= 0 && value < StartupCommunicationState._size)
            {
                StartupCommunicationState._array[this._value] = this;
            }
        }
        public bool Equals(StartupCommunicationState otherEnum)
        {
            return otherEnum.Value() == this._value;
        }
        public override string ToString()
        {
            return StartupCommunicationState.displayStrings[this._value];
        }
    }
}
